<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" name="referrer" content="no-referrer">
    <title>Title</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/css/blog.css}">
    <link rel="stylesheet" th:href="@{/css/timeline.css}"/>
</head>
<body>
<div class="blog-masthead">
    <div class="container">
        <nav class="navbar navbar-default">
            <div class="container-fluid">
                <div class="navbar-header">
                    <button class="navbar-toggle collapsed" type="button" data-toggle="collapse"
                            data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="false">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" th:href="@{/index}">首 页</a>
                </div>
                <div id="bs-navbar" class="collapse navbar-collapse">
                    <ul class="nav navbar-nav">
                        <li><a th:href="@{/interview}" class="blog-nav-item">面试那些事</a></li>
                        <li class="active"><a href="#" class="blog-nav-item">时间旅行</a></li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li class="dropdown hidden-xs" th:if="${session?.loginUser}!=null">
                            <a href="#" class="blog-nav-img" data-toggle="dropdown" role="button" aria-haspopup="true"
                               aria-expanded="false">
                                <img th:src="${session?.loginUser?.photo ne null}?
                                ${session?.loginUser?.photo}:@{/images/icon-user.png}"
                                     alt="头像" class="img-circle picture shadow">
                            </a>
                            <ul class="dropdown-menu">
                                <li><a th:href="@{'/dynamic/'+${session?.loginUser?.id}}">我的动态</a></li>
                                <li><a th:href="@{'/mydata/'+${session?.loginUser.id}}">我的资料</a></li>
                                <li><a th:href="@{/issue}">发布文章</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a th:href="@{/logout}">退出</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </div>
</div>

<section id="timeTravel" class="timeTravel">
    <h3 class="text-center">时间不能增添一个人的寿命，然而珍惜光阴可使生命变得更有价值。</h3>
    <div id="cd-timeline" class="cd-container" th:if="${list ne null}">
        <div class="cd-timeline-block" th:each="timeTravel:${list}">
            <div class="cd-timeline-img cd-picture">
                <img th:src="${timeTravel?.picture}" alt="Picture">
            </div>
            <div class="cd-timeline-content">
                <h2 th:text="${timeTravel?.title}"></h2>
                <p th:text="${timeTravel?.content}"></p>
                <span class="cd-date" th:text="${timeTravel?.time}"></span>
            </div>
        </div>
    </div>
</section>

<footer class="blog-footer">
    <p>青柠的博客</p>
    <p>
        <a href="#">返回顶部</a>
    </p>
</footer>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/modernizr.js}"></script>
<script>
    $(function () {
        var $timeline_block = $('.cd-timeline-block');
        //hide timeline blocks which are outside the viewport
        $timeline_block.each(function () {
            if ($(this).offset().top > $(window).scrollTop() + $(window).height() * 0.75) {
                $(this).find('.cd-timeline-img, .cd-timeline-content').addClass('is-hidden');
            }
        });
        //on scolling, show/animate timeline blocks when enter the viewport
        $(window).on('scroll', function () {
            $timeline_block.each(function () {
                if ($(this).offset().top <= $(window).scrollTop() + $(window).height() * 0.75 && $(this).find('.cd-timeline-img').hasClass('is-hidden')) {
                    $(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in');
                }
            });
        });
    });
</script>
</body>
</html>